/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       combat_creature_icon.cpp

	$Header: /game/combat_creature_icon.cpp $

	$NoKeywords: $

 ************************************************************************/

#include "precompiled.h"
#include "combat_creature_icon.h"

#include "combat_creature.h"
#include "combat_window.h"
#include "dialog_combat_creature.h"
#include "mouse_event.h"

// ----------------------------------------------------------------
// display a creature / hero portrait in a ring, and include help text / right click
// ----------------------------------------------------------------
t_combat_creature_icon::t_combat_creature_icon( t_screen_rect const& rect, t_window* parent, t_combat_window* combat_window )
                      : t_creature_icon_window( rect, parent ), 
						m_combat_window( combat_window )
{
}

// ----------------------------------------------------------------
// display a creature / hero portrait in a ring, and include help text / right click
// ----------------------------------------------------------------
void t_combat_creature_icon::right_button_up( t_mouse_event const& event )
{
	if (m_creature == 0)
		return;

	t_screen_point window_origin;
	t_window*      help_window;
	
	window_origin = m_combat_window->to_client( event.screen_point );
	help_window = new t_dialog_combat_creature( m_creature, 
												m_combat_window->get_battlefield(),
												window_origin, m_combat_window,
		                                        m_combat_window->get_client_rect() );
}

// ----------------------------------------------------------------
// display a creature / hero portrait in a ring, and include help text / right click
// ----------------------------------------------------------------
void t_combat_creature_icon::set_creature( t_combat_creature const * creature, bool force_awake_portrait )
{
	m_creature = creature;
	t_creature_icon_window::set_creature( creature, force_awake_portrait );
}

// ----------------------------------------------------------------
// ----------------------------------------------------------------
void t_combat_creature_icon::clear_creature()
{
	m_creature = NULL;
	t_creature_icon_window::clear_creature();
}
